<template>
	<view>
		<!-- 测试提交前 -->
		<view class="headbgc"></view>
		<view class="mainpadding2 contentmsg">
			<view class="mainpadding_top topradius textcenter hei_text bold">{{dataAll.name}}</view>
			<view class="ffffff contentradius mainpadding">
				<view class="flexbetween">
					<view class="flexleft">
						<u-icon name="clock" color="#2979ff" size="20"></u-icon>
						<view class="hui_text main_size bold margin_left1">考试时间：{{dataAll.duration}}分钟</view>
					</view>
					<view class="hui_text main_size bold">试卷总分：{{dataAll.total_score}}分</view>
				</view>
				<view class="mainpadding_top radius" style="background-color: #f8f8fa;">
					<view class="pdl flexbetween" v-if="dataAll.choice_num">
						<view class="hui_text main_size bold">选择（{{dataAll.choice_num}}题）</view>
						<view class="lan_text main_size bold">{{dataAll.choice_score}}分</view>
					</view>
					<view class="pdl margin_top flexbetween" v-if="dataAll.judge_num">
						<view class="hui_text main_size bold">判断（{{dataAll.judge_num}}题）</view>
						<view class="lan_text main_size bold">{{dataAll.judge_score}}分</view>
					</view>
					<view class="pdl margin_top flexbetween" v-if="dataAll.matching_num">
						<view class="hui_text main_size bold">连线（{{dataAll.matching_num}}题）</view>
						<view class="lan_text main_size bold">{{dataAll.matching_score}}分</view>
					</view>
					
					<view class="pdl margin_top flexbetween" v-if="dataAll.fill_num">
						<view class="hui_text main_size bold">填空（{{dataAll.fill_num}}题）</view>
						<view class="lan_text main_size bold">{{dataAll.fill_score}}分</view>
					</view>
					<view class="margin_top flexbetween" v-if="dataAll.saq_num">
						<view class="hui_text main_size bold">简答（{{dataAll.saq_num}}题）</view>
						<view class="lan_text main_size bold">{{dataAll.saq_score}}分</view>
					</view>
				</view>
			</view>
		</view>
		<view class="posibottom mainpadding" style="z-index: 10;">
			<view class="submitbtn" @click="kaishiks">开始考试</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				education_lesson_id: "", //课程id
				student_examination_id: "", //测试记录id
				dataAll:{},
			}
		},
		onLoad(options) {
			this.education_lesson_id = options.id
			if (options.student_examination_id) {
				this.student_examination_id = options.student_examination_id
			}
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('/api/examination/start_show', 'GET', {
					education_lesson_id: this.education_lesson_id,
					student_examination_id: this.student_examination_id
				}, false, false, true).then(res => {
					this.dataAll = res.data
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			kaishiks(){//开始考试
				let data = {
					education_lesson_id:this.education_lesson_id,
					student_examination_id:this.student_examination_id,
					duration:this.dataAll.duration
				}
				uni.navigateTo({
					url:"/pages_index/ceshi?data=" + encodeURIComponent(JSON.stringify(data))
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.headbgc {
		background: linear-gradient(180deg, #3478F5 0%, #fafafa 100%);
		height: 400rpx;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
	}

	.topradius {
		border-radius: 15rpx 15rpx 0 0;
		background-color: #f1f1f1;
		font-size: 30rpx;
	}

	.contentmsg {
		position: relative;
		z-index: 2;
	}

	.contentradius {
		border-radius: 0 0 15rpx 15rpx;
	}
</style>